home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 05.zip / BS1 part 5 / IM_3 .adf / Exec / piarc.LZH / iraw.rexx < prev    next >
OS/2 REXX Batch file  |  1992-04-13  |  3KB  |  139 lines

  1. /*
  2.  * IRAW.rexx   - I-raw is a 'chunky' graphics format used on
  3.  *               DEC VAX platforms, and as an interchange image format
  4.  *               between VAX graphics and Intel based machines.
  5.  *
  6.  *  Written by: Barry Chalmers
  7.  * Last Update: February 15th, 1992
  8.  *         For: Black Belt Systems image processing series IM, IM F/c, and IP.
  9.  * ---------------------------------------------------------------------------
  10.  *    Revision: 1.01 - see ReadMe file for details on changes to this level
  11.  */
  12.  
  13. /*
  14.  * open rexxsupport.library -- needed for some functions
  15.  */
  16. if ~show('L',"rexxsupport.library") then do
  17.   if addlib('rexxsupport.library',0,-30,0) then do
  18.       /* everything's ok */
  19.     end;
  20.   else do
  21.     say 'We Have A Library Problem, Unable To Load "rexxsupport.library"';
  22.     say 'Cannot operate JPEG.rexx without this library - sorry!';
  23.     exit 10;
  24.     end;
  25.   end;
  26.  
  27. /*
  28.  * This will automatically direct the script to the proper
  29.  * software, if it is running.
  30.  */
  31. prtnme = 'IP_Port'; /* assume Image Professional */
  32. if show('P','IP_Port') = 0 then do
  33.   if show('P','IM_Port') = 0 then do
  34.     say "Can't find image processor's ARexx port!!!"; /* not running? */
  35.     say "This script requires IP, IM or IM F/c to run!";
  36.     exit(20);
  37.     end;
  38.   else do
  39.     prtnme = 'IM_Port'; /* That's the thing about assumptions... */
  40.     end;                 /* We make em, user's break em.          */
  41.   end;
  42.  
  43.   /*
  44.    * This code attempts to read a file called "picmdpath" from REXX:
  45.    * If it can't find it, the script will assume that the commands
  46.    * associated with this PI Module are in "c:". If the file exists,
  47.    * the script will look in the path that is specified in the file.
  48.    * If you create this file, you MUST put a complete, correct path
  49.    * in it; if the commands are in a sub-directory, you have to put
  50.    * the trailing slash on the path (like, device:dir/).
  51.    * 
  52.    */
  53.   cmdpath = 'c:';
  54.   if open(fhandle,'rexx:picmdpath','read') then  /* open the file */
  55.     do
  56.       cmdpath = readln(fhandle);
  57.       call close(fhandle);  /* close the file    */
  58.     end
  59.  
  60. address(prtnme);
  61.  
  62. options results;
  63. 'gadgets "Load","I-raw","Save","I-raw"';
  64. pick = result;
  65. options;
  66.  
  67. if pick=0 then do
  68.   exit 0;
  69.   end;
  70.  
  71. path = 'ram:';
  72. name = '';
  73. ext  = '';
  74.  
  75. if pick = 1 then do
  76.   options results;
  77.   'filerequest "'||path||'","'||name||'","'||ext||'","Load I-raw"';
  78.   irawfile = result;
  79.   options;
  80.  
  81.   if irawfile = 'FR_CANCELLED' then do
  82.     address(prtnme);
  83.     'imtofront';
  84.     exit 0;
  85.     end;
  86.  
  87.   address(prtnme);
  88.   options results;
  89.   'jackin';
  90.   jackadr = result;
  91.   options;
  92.  
  93.   address command cmdpath||'iraw '||jackadr||' 0 '||irawfile;
  94.  
  95.   call open(fhandle,'ram:imiraw.report','read');
  96.   linet = readch(fhandle,20)
  97.   parse var linet xw ',' yw
  98.   say xw||' , '||yw
  99.   call close(fhandle);
  100.   
  101.   address(prtnme);
  102.   'newasprimary '||xw||','||yw||' Iraw'
  103.   
  104.   address(prtnme);
  105.   options results;
  106.   'jackin';
  107.   jackadr = result;
  108.   options;
  109.  
  110.   address command cmdpath||'iraw '||jackadr||' 1 '||irawfile;
  111.   address(prtnme);
  112.   'redraw'
  113.   
  114.     exit 0;
  115.   enddo
  116. if pick = 2 then do
  117.   options results;
  118.   'filerequest "'||path||'","'||name||'","'||ext||'","Save I-raw"';
  119.   irawfile = result;
  120.   options;
  121.  
  122.   if irawfile = 'FR_CANCELLED' then do
  123.     address(prtnme);
  124.     'imtofront';
  125.     exit 0;
  126.     end;
  127.  
  128.   address(prtnme);
  129.   options results;
  130.   'jackin';
  131.   jackadr = result;
  132.   options;
  133.  
  134.   address command cmdpath||'iraw '||jackadr||' 2 '||irawfile;
  135.  
  136.     exit 0;
  137.   enddo
  138. exit 0;
  139. end